-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle packing of empty RDATA correctly for EDNS0_EXPIRE (Resolves #1292) #1293
Conversation
Thanks. Could you provide a better description in your commit. uint32 was plain wrong? Where in the RFC do I need to look? Etc. |
I've documented the bug and thought process in the issue mentioned. I've also changed the description in the commit to also mention the RFC and the issue: As per RFC7314 the Expire Option in queries should be zero-length. In the current implementation the field is |
3a613c4
to
3d6a1d5
Compare
…iekg#1292) As per [RFC7134](https://datatracker.ietf.org/doc/html/rfc7314#section-2) the Expire Option in queries should be zero-length. In the current implementation the field is uint32 which always instatiates 4bytes for that field when packing to wire format. For that reason we change the field to []uint8 so it can support 0-length and 4-byte length option data.
3d6a1d5
to
8161c7d
Compare
@miekg thanks for the review; I've addressed the comments. Please take a look again! |
(Apologies for the absence on GitHub). RFC 7314 says "This is done by adding a zero-length EDNS EXPIRE option to the options field of the OPT record when the query is made." so a zero length option is valid and something we should be handling. There's nothing in the RFC to say that the 32-bit value zero is reserved so we have to persist this somehow. This PR isn't backward compatible though so we shouldn't merge as-is. What we could do is hang a flag off |
Can you elaborate for the backwards compatibility issue? |
Any code that operates on func adjustExpire(opt *EDNS0_EXPIRE) {
if opt.Expire < 10 {
opt.Expire = 10
} else {
opt.Expire++
}
} Even code that simply inspects or prints the value of A flag allows us to track whether we're writing zero or four bytes and persist that from unpack to pack without (hopefully) breaking any existing code. |
oh gotcha, I will update the PR to avoid this issue |
@tmthrgd found some time to make the change. please check to see if the implementation is sufficient. |
hey @tmthrgd I think this PR is ready for merging! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. As long as we're happy with the String
output.
…ekg#1292) (miekg#1293) * Change EDNS_EXPIRE field to support zero length option data (Resolves miekg#1292) As per [RFC7134](https://datatracker.ietf.org/doc/html/rfc7314#section-2) the Expire Option in queries should be zero-length. In the current implementation the field is uint32 which always instatiates 4bytes for that field when packing to wire format. For that reason we change the field to []uint8 so it can support 0-length and 4-byte length option data. * addressed comments * addressed comments * make change backwards compatible * add comment for Empty field
Issue explained in #1292